/*
 *HCIAssDriver.java   Feb 23, 2008
 * Developer: sandarenu
 * Copyright (c) 2006-2008 Minimuthu Software Developers.
 * Sri Lanka.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of 
 * Minimuthu Software Developers. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with Minimuthu.
 */
package treetabledemo;

import javax.swing.SwingUtilities;
import java.awt.BorderLayout;
import javax.swing.JPanel;
import javax.swing.JFrame;
import javax.swing.UIManager;

import java.awt.Dimension;
import java.awt.GridLayout;
import java.awt.Image;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;

import javax.swing.JButton;

/**
 * @author sandarenu
 *
 */
public class HCIAssDriver extends JFrame
{

	private static final long serialVersionUID = 1L;

	private JPanel jContentPane = null;

	private JButton btnNormalTable = null;

	private JButton btnTreeTable = null;

	private JButton btnTableEditor = null;
	
	private Image icon;

	/**
	 * This method initializes btnNormalTable	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnNormalTable()
	{
		if (btnNormalTable == null)
		{
			btnNormalTable = new JButton();
			btnNormalTable.setText("Normal Table");
			btnNormalTable.addActionListener( new java.awt.event.ActionListener()
			{
				public void actionPerformed(ActionEvent e)
				{
					NormalTableDemo ntd = new NormalTableDemo(icon);
				}
			});
		}
		return btnNormalTable;
	}

	/**
	 * This method initializes btnTreeTable	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnTreeTable()
	{
		if (btnTreeTable == null)
		{
			btnTreeTable = new JButton();
			btnTreeTable.setText("Tree Table");
			btnTreeTable.addActionListener(new java.awt.event.ActionListener()
			{
				public void actionPerformed(java.awt.event.ActionEvent e)
				{
					TreeTableDemo ttd = new TreeTableDemo(icon);
				}
			});
		}
		return btnTreeTable;
	}

	/**
	 * This method initializes btnTableEditor	
	 * 	
	 * @return javax.swing.JButton	
	 */
	private JButton getBtnTableEditor()
	{
		if (btnTableEditor == null)
		{
			btnTableEditor = new JButton();
			btnTableEditor.setText("Table with Cell Editor");
			btnTableEditor.addActionListener( new java.awt.event.ActionListener()
			{
				public void actionPerformed(ActionEvent e)
				{
					CellEditorTableDemo ntd = new CellEditorTableDemo(icon);
				}
			});
		}
		return btnTableEditor;
	}

	/**
	 * Created on: Feb 23, 2008
	 * @Author sandarenu
	 * @param args
	 */
	public static void main(String[] args)
	{
    	try
		{
			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
			//MessageBox.showErrorMessage("Unable to set Windows Look And Feel");
		}
		
		// TODO Auto-generated method stub
		SwingUtilities.invokeLater(new Runnable()
		{
			public void run()
			{
				HCIAssDriver thisClass = new HCIAssDriver();
				thisClass.setLocation(50, 50);
				thisClass.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
				thisClass.setVisible(true);
				
			}
		});
	}

	/**
	 * This is the default constructor
	 */
	public HCIAssDriver()
	{
		super();
		initialize();
	}

	/**
	 * This method initializes this
	 * 
	 * @return void
	 */
	private void initialize()
	{
		Toolkit kit = Toolkit.getDefaultToolkit();
		icon = kit.getImage("icons/atom.png");
		this.setSize(230, 250);
		this.setContentPane(getJContentPane());
		this.setIconImage(icon);
		this.setTitle("HCI Assignment");
	}

	/**
	 * This method initializes jContentPane
	 * 
	 * @return javax.swing.JPanel
	 */
	private JPanel getJContentPane()
	{
		if (jContentPane == null)
		{
			GridLayout gridLayout = new GridLayout();
			gridLayout.setRows(3);
			gridLayout.setVgap(15);
			gridLayout.setHgap(15);
			jContentPane = new JPanel();
			jContentPane.setLayout(gridLayout);
			jContentPane.add(getBtnNormalTable(), null);
			jContentPane.add(getBtnTreeTable(), null);
			jContentPane.add(getBtnTableEditor(), null);
		}
		return jContentPane;
	}

	/**
	 * @return the icon
	 */
	public Image getIcon()
	{
		return icon;
	}

}  //  @jve:decl-index=0:visual-constraint="10,10"
